import request from '@/utils/request'

// 创建订单记录
export function vipOrderRecord() {
  return request({
    url: `/api/vip/vipOrderRecord`,
    method: 'post'
  })
}

// 微信支付
export function weChatPay(data) {
  return request({
    url: `/api/vip/weChat/weChatPay/${data}`,
    method: 'put'
  })
}

// 会费记录详情
export function getVipOrderRecord(data) {
  return request({
    url: `/api/vip/vipOrderRecord/${data}`,
    method: 'get'
  })
}

// 获取支付状态
export function getPaymentState(data) {
  return request({
    url: `/api/vip/vipOrderRecord/paymentState/${data}`,
    method: 'get'
  })
}

// 对公-完成付款调用
export function completePayment(id) {
  return request({
    url: `/api/vip/remittances/completePayment/${id}`,
    method: 'put'
  })
}

// 取消支付
export function cancelPay(id, data) {
  return request({
    url: `/api/vip/vipOrderRecord/state/${id}`,
    method: 'put',
    data
  })
}

// 获取服务订单记录详情
export function getServiceOrderRecord(id) {
  return request({
    url: `/api/vip/ServiceOrderRecord/${id}`,
    method: 'get'
  })
}

// 创建服务订单
export function buyServiceOrderRecord(id) {
  return request({
    url: `/api/vip/ServiceOrderRecord/buy/${id}`,
    method: 'post'
  })
}

// 获取服务订单列表
export function getServiceOrderRecordList(data) {
  return request({
    url: `/api/vip/ServiceOrderRecord/getList`,
    method: 'post',
    data
  })
}

// 获取服务订单支付状态
export function getServicePaymentState(id) {
  return request({
    url: `/api/vip/ServiceOrderRecord/paymentState/${id}`,
    method: 'get'
  })
}

// 更新服务订单状态
export function updateServiceState(id, data) {
  return request({
    url: `/api/vip/ServiceOrderRecord/state/${id}`,
    method: 'put',
    data
  })
}

// 服务微信支付
export function weChatPayByService(data) {
  return request({
    url: `/api/vip/weChat/weChatPayByService/${data}`,
    method: 'put'
  })
}
